<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/views/include/easyui.jsp"%>

</head>
<body>
<div>
	<form id="mainform" action="${ctx}/shop/goods/${action}/${goodsTypeId}" method="post">
	<table  class="formTable">
		<tr>
			<td>Producte Name：</td>
			<td>
			<input type="hidden" name="id" value="${id }" />
			<input name="name" type="text" value="${goods.name }" class="easyui-validatebox"  data-options="required:true,validType:['length[0,255]']" />
			</td>
		</tr>
		<tr>
			<td>Photo：</td>
			<td><input name="cover1" id="cover1" type="text" value="${goods.photoName }" readonly="true" class="easyui-validatebox" data-options="required:false"/>
			<input name="cover" id="cover" type="text" value="${goods.cover }" hidden="true"  class="easyui-validatebox" data-options="required:false"/>
		</td>
		</tr>
		<tr>
			<td>Item NO.：</td>
			<td><input name="img" type="text" value="${goods.img }" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Producte Type：</td>
			<td><input id="pid" name="pid" class="easyui-validatebox" value="${goods.goodsType.name }" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Description&Specification：</td>
			<td><input name="introduce" type="text" value="${goods.introduce }" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>40HQ：</td>
			<td><input name="containers" type="text" value="${goods.containers}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Packing Size：</td>
			<td><input name="packSize" type="text" value="${goods.packSize}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Valume/cbm：</td>
			<td><input name="valume" type="text" value="${goods.valume}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>G.W.：</td>
			<td><input name="grossWeight" type="text" value="${goods.grossWeight}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Supplier Quotation：</td>
			<td><input name="supplierQuotation" type="text" value="${goods.supplierQuotation}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Unit Price：</td>
			<td><input name="unitPrice" type="text" value="${goods.unitPrice}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Set Price：</td>
			<td><input name="setPrice" type="text" value="${goods.setPrice}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Port：</td>
			<td><input name="port" type="text" value="${goods.port}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>DeliveryTime(1*40HQ)：</td>
			<td><input name="deliveryTime" type="text" value="${goods.deliveryTime}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
		<tr>
			<td>Remark：</td>
			<td><input name="remark" type="text" value="${goods.remark}" class="easyui-validatebox" data-options="required:false"/></td>
		</tr>
	</table>
	<input name="uploadify" id="uploadify" type="file" value="上传照片"  multiple="true" />
				<div id="queue"></div></div>
	</form>
	
</div>
<script type="text/javascript">
function putFileName(oldName,url){
	document.getElementById("cover1").value=oldName;
	document.getElementById("cover").value=url;
}
function setValue(value){
	
	$('#mainform').attr("action","${ctx}/shop/goods/${action}/"+value);
}
$(function(){
	debugger
	$("#uploadify").uploadify({
	       'swf'            : '${ctx}/static/images/uploadify.swf',
	       //swf路径
	       'uploader'       : '${ctx}/uploadFile',
	       //后台调用的上传方法
	       'fileObjName'    : "goods",
	       //文件夹名
	       'queueID'        : 'queue',
	       //文件队列的ID，该ID与存放文件队列的div的ID一致。
	        'buttonText'     : '上传照片',
	       'width'			 : '70',
	       'height'		 : '70',
	       'fileTypeExts'   : '*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.psd;*.tiff;'
	   });
	//上级菜单
	$('#pid').combotree({
		width:180,
		method:'GET',
	    url: '${ctx}/shop/goodsType/json',
	    idField : 'id',
	    textFiled : 'name',
		parentField : 'goodsTypeId',
		onSelect: function (node) {
			setValue(node.id);
			},
	    animate:true
	});  
	$('#mainform').form({    
	    onSubmit: function(){    
	    	var isValid = $(this).form('validate');
			return isValid;	// 返回false终止表单提交
	    },    
	    success:function(data){   
	    	if(successTip(data,dg,d))
	    		dg.treegrid('reload');
	    }    
	}); 
});

</script>
</body>
</html>